﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using WindowsGame.Common.Inputs.Types;
using WindowsGame.Common.Interfaces;

namespace WindowsGame.Common.Inputs
{
	public class XboxInputFactory : BaseInputFactory, IInputFactory
	{
		public XboxInputFactory(IJoystickInput joystickInput)
		{
			JoystickInput = joystickInput;
		}

		public void Update(GameTime gameTime)
		{
			JoystickInput.Update(gameTime);
		}

		protected override Boolean HoldUp()
		{
			return JoyHoldUp();
		}
		protected override Boolean HoldDown()
		{
			return JoyHoldDown();
		}
		protected override Boolean HoldLeft()
		{
			return JoyHoldLeft();
		}
		protected override Boolean HoldRight()
		{
			return JoyHoldRight();
		}

		protected override Boolean MoveUp()
		{
			return JoyMoveUp();
		}
		protected override Boolean MoveDown()
		{
			return JoyMoveDown();
		}
		protected override Boolean MoveLeft()
		{
			return JoyMoveLeft();
		}
		protected override Boolean MoveRight()
		{
			return JoyMoveRight();
		}

		public Boolean Escape()
		{
			return JoyEscape();
		}
		public Boolean Start()
		{
			return JoyHold(Buttons.Start) || JoyHold(Buttons.A);
		}
		public Boolean Reset()
		{
			return JoyHold(Buttons.X) || JoyHold(Buttons.Y);
		}

	}
}